import './assets/main.css'

import { createApp } from 'vue'
import pinia from './stores'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import App from './App.vue'
import router from './router'
import jComponent from './components/index.ts'

const app = createApp(App)

function transElIconName(iconName: string) {
  return 'el-icon' + iconName.replace(/[A-Z]/g, (match) => '-' + match.toLowerCase())
}
// // 统一注册el-icon图标
for (const iconName in ElementPlusIconsVue) {
  app.component(transElIconName(iconName), ElementPlusIconsVue[iconName])
}

app.use(pinia)
app.use(router)
app.use(ElementPlus)
app.use(jComponent)

app.mount('#app')
